﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LinqTest
{
    public partial class ShowDate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            NorthwindDataContext dc = new NorthwindDataContext();
            //var order = from o in dc.Orders
            //            from d in o.Order_Details
            //            where o.OrderID == 10248
            //            select d;
            //GridView1.DataSource = order;
            //GridView1.DataBind();

            //Orders order = dc.Orders.Single(o => o.OrderID == 10248);
            //order.ShipName = "Vins et alcools Chevalier";
            //dc.SubmitChanges();

            //Order_Details od = new Order_Details();
            //od.Discount = 0;
            //od.OrderID = 10248;
            //od.ProductID = 1;
            //od.UnitPrice = 59.9M;
            //od.Quantity = 1;
            //dc.Order_Details.InsertOnSubmit(od);
            //dc.SubmitChanges();


            //Order_Details od = dc.Order_Details.SingleOrDefault(d => d.ProductID == 1 && d.OrderID == 10248);
            //if (od != null)
            //{
            //    dc.Order_Details.DeleteOnSubmit(od);
            //}
            //dc.SubmitChanges();

        }

        void order_PropertyChanging(object sender, System.ComponentModel.PropertyChangingEventArgs e)
        {
            //throw new NotImplementedException();
            Orders order = sender as Orders;
        }
    }
}